/*
 * @(#)Account.java 0.0.1-SNAPSHOT
 * Copyright Group B
 */

package grupb.upf.XMLObjects.impl;

/**
 * <p>This class implements Account. It is used to manage
 * the Account objects.</p>
 *
 * @version    0.0.1-SNAPSHOT
 * @author     Group B
 */
public final class Account implements grupb.upf.XMLObjects.Account {
    /**
     * This is the username of the user.
     */
    private String aUsername;
    /**
     * This is the password of the user.
     */
    private String aPassword;
    /**
     * This is the type of account of the user.
     */
    private String aType;

    /**
     * This is the constructor of the accounts.
     * @param username the username of the user
     * @param password the password of the user
     * @param type the type of account of the user
     */
    public Account(final String username, final String password,
            final String type) {
        this.aUsername = username;
        this.aPassword = password;
        this.aType = type;
    }

    /**
     * Constructor to create an account void.
     */
    public Account() {
        this.aUsername = "";
        this.aPassword = "";
        this.aType = "";
    }

    /**
     * This method let us to set the username.
     * @param username the new nick of the username
     */
    @Override
    public void setUsername(final String username) {
        this.aUsername = username;
    }

    /**
     * This method let us to get the username.
     * @return the nick of the username
     */
    @Override
    public String getUsername() {
        return this.aUsername;
    }

    /**
     * This method let us to set the password of the user.
     * @param password the new password of the user
     */
    @Override
    public void setPassword(final String password) {
        this.aPassword = password;
    }

    /**
     * This method let us to get the password of the user.
     * @return the password of the username
     */
    @Override
    public String getPassword() {
        return this.aPassword;
    }

    /**
     * This method let us to set the type of account (google, picassa...).
     * @param type the type of account of the user
     */
    @Override
    public void setType(final String type) {
        this.aType = type;
    }

    /**
     * This method let us to get the type of the account.
     * @return the type of the account
     */
    @Override
    public String getType() {
        return this.aType;
    }

    /**
     * This method returns us the info of the user in a String.
     * @return the info of the user
     */
    @Override
    public String getAccountInfo() {
        StringBuffer st = new StringBuffer();
        st.append("\nUsername: ")
          .append(this.aUsername)
          .append("\nPassword: ")
          .append(this.aPassword)
          .append("\nType: ")
          .append(this.aType);
        return st.toString();
    }
}
